<!-- 绿色通道 - 患者列表 - 医疗记录 - NIHSS评分 界面 -->
<template>
  <div id="box">
    <div class="tab-pane">
      <div class="addContent">
        <el-button
          type="primary"
          style="float: right; margin-right: 40px; padding: 8px 15px"
          @click="popup"
        >新 增</el-button>
      </div>
      <div v-show="NIHSSDataList.length" class="content">
        <div v-for="(listItem, index) in NIHSSDataList" :key="index" class="inside">
          <span>NIHSS评分类型：</span>
          <el-button
            type="primary"
            style="float: right; margin-right: 40px; padding: 8px 15px"
            @click="saveStrokeNIHSSData(listItem)"
          >保存</el-button>
          <el-select
            v-model="listItem.type"
            placeholder="请选择"
            style="width: 40%"
            required
          >
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
          <div class="center">
            <div class="each">
              <div class="eachItem">
                <div class="text">意识水平 ：</div>
                <el-radio-group
                  v-model="listItem.consciousness"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(levelOfConsciousnessItem, indOne) in levelOfConsciousness"
                    :key="indOne"
                    :label="levelOfConsciousnessItem"
                  >
                    {{ levelOfConsciousnessItem }}
                  </el-radio>
                </el-radio-group>
              </div>
              <div class="eachItem">
                <div class="text">意识水平提问（月份、年龄）：</div>
                <el-radio-group
                  v-model="listItem.action"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(levelageItem, indTwo) in levelage"
                    :key="indTwo"
                    :label="levelageItem"
                  >
                    {{ levelageItem }}
                  </el-radio>
                </el-radio-group>
              </div>
              <div class="eachItem">
                <div class="text">意识水平提问（睁闭眼、捏拳松开）：</div>
                <el-radio-group
                  v-model="listItem.birth"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(levelEyesClosedItem, indThree) in levelEyesClosed"
                    :key="indThree"
                    :label="levelEyesClosedItem"
                  >
                    {{ levelEyesClosedItem }}
                  </el-radio>
                </el-radio-group>
              </div>
              <div class="eachItem">
                <div class="text">眼睛—凝视 ：</div>
                <el-radio-group
                  v-model="listItem.gaze"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(eyesGazeItem, indfour) in eyesGaze"
                    :key="indfour"
                    :label="eyesGazeItem"
                  >{{ eyesGazeItem }}</el-radio>
                </el-radio-group>
              </div>
              <div class="eachItem">
                <div class="text">眼睛—视野 ：</div>
                <el-radio-group
                  v-model="listItem.view"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(eyesVisionItem, indFives) in eyesVision"
                    :key="indFives"
                    :label="eyesVisionItem"
                  />
                </el-radio-group>
              </div>
              <div class="eachItem">
                <div class="text">面部—面瘫 ：</div>
                <el-radio-group
                  v-model="listItem.facialParalysis"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(facialParalysisItem, indSix) in facialParalysis"
                    :key="indSix"
                    :label="facialParalysisItem"
                  >{{ facialParalysisItem }}</el-radio>
                </el-radio-group>
              </div>
              <div class="eachItem">
                <div class="text">上肢运动（左上肢） ：</div>
                <el-radio-group
                  v-model="listItem.upperLimbMovement"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(upperMovementItem, indSeven) in upperMovement"
                    :key="indSeven"
                    :label="upperMovementItem"
                  >{{ upperMovementItem }}</el-radio>
                </el-radio-group>
              </div>
              <div class="eachItem">
                <div class="text">上肢运动（右上肢） ：</div>
                <el-radio-group
                  v-model="listItem.upperLimbMovementb"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(upperMovementItemb, indEight) in upperMovement"
                    :key="indEight"
                    :label="upperMovementItemb"
                  >{{ upperMovementItemb }}</el-radio>
                </el-radio-group>
              </div>

              <div class="eachItem">
                <div class="text">下肢运动（左下肢） ：</div>
                <el-radio-group
                  v-model="listItem.lowerLimbMovement"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(lowerMovementItem, indSeven) in lowerMovement"
                    :key="indSeven"
                    :label="lowerMovementItem"
                  >{{ lowerMovementItem }}</el-radio>
                </el-radio-group>
              </div>
              <div class="eachItem">
                <div class="text">下肢运动（右下肢） ：</div>
                <el-radio-group
                  v-model="listItem.lowerLimbMovementb"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(lowerMovementItemb, indEight) in lowerMovement"
                    :key="indEight"
                    :label="lowerMovementItemb"
                  >{{ lowerMovementItemb }}</el-radio>
                </el-radio-group>
              </div>
              <div class="eachItem">
                <div class="text">肢体共济失调 ：</div>
                <el-radio-group
                  v-model="listItem.limbAtaxia"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(limbAtaxiaItem, indNine) in limbAtaxia"
                    :key="indNine"
                    :label="limbAtaxiaItem"
                  >{{ limbAtaxiaItem }}</el-radio>
                </el-radio-group>
              </div>
              <div class="eachItem">
                <div class="text">感觉 ：</div>
                <el-radio-group
                  v-model="listItem.feel"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(feelItem, indTen) in feel"
                    :key="indTen"
                    :label="feelItem"
                  >{{ feelItem }}</el-radio>
                </el-radio-group>
              </div>
              <div class="eachItem">
                <div class="text">语言（命名、阅读调试）：</div>
                <el-radio-group
                  v-model="listItem.language"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(languageItem, indEleven) in language"
                    :key="indEleven"
                    :label="languageItem"
                  >{{ languageItem }}</el-radio>
                </el-radio-group>
              </div>
              <div class="eachItem">
                <div class="text">构音障碍 ：</div>
                <el-radio-group
                  v-model="listItem.dysarthria"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(dysarthriaItem, indTwelve) in dysarthria"
                    :key="indTwelve"
                    :label="dysarthriaItem"
                  >{{ dysarthriaItem }}</el-radio>
                </el-radio-group>
              </div>
              <div class="eachItem">
                <div class="text">消退或不注意忽视 ：</div>
                <el-radio-group
                  v-model="listItem.subside"
                  class="single"
                  @change="listItem = changeValue(listItem)"
                >
                  <el-radio
                    v-for="(fadeAwayItem, indThirteen) in fadeAway"
                    :key="indThirteen"
                    :label="fadeAwayItem"
                  >{{ fadeAwayItem }}</el-radio>
                </el-radio-group>
              </div>

              <div>
                <el-row>
                  <span>
                    <span>NIHSS评分结果：<el-input
                      v-model="listItem.score"
                      style="width: 100px"
                      disabled
                    />分</span>
                    <el-input v-model="listItem.result" style="width: 400px" disabled />
                  </span>
                </el-row>
              </div>

              <el-input
                v-model="listItem.remark"
                style="width: 80%"
                placeholder="备注："
              >备 注</el-input>
              <!-- <el-button type="primary" style="margin:10px 0px 10px 92%;width:6%;">保  存</el-button> -->
            </div>
          </div>
          <el-divider />
        </div>
        <div class="footerContent">
          <el-button type="text" @click="goViewNIHSS()">
            <span style="margin: 0 5px; font-size: 15px">查看NIHSS评分趋势图</span>
            <span style="margin: 0 20px; font-size: 15px">></span>
          </el-button>
          <el-dialog title="NIHSS评分趋势图" :visible.sync="dialogVisible" width="50%">
            <div v-if="dialogVisible">
              <div ref="chart" style="width: 100%; height: 400px" />
            </div>
            <span slot="footer" class="dialog-footer">
              <el-button @click="dialogVisible = false">取 消</el-button>
              <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
            </span>
          </el-dialog>
        </div>
      </div>
    </div>

    <el-dialog
      title="新增NIHSS评分"
      :visible.sync="newincalogase"
      width="61%"
      :before-close="handleClose"
    >
      <el-form
        ref="ruleForm"
        :model="ruleForm"
        :rules="rules"
        label-width="180px"
        class="demo-ruleForm"
        label-position="left"
      >
        <el-form-item label="评分类型" prop="ratingType">
          <el-select v-model="ruleForm.ratingType" placeholder="请选择NIHSS评分类型">
            <el-option
              v-for="optionsitem in options"
              :key="optionsitem.value"
              :value="optionsitem.value"
            >
              <el-form-item
                :label="optionsitem.label"
                label-width="10px"
                :required="
                  optionsitem.label == '入院NIHSS评分' ||
                    optionsitem.label == '溶栓前NIHSS评分' ||
                    optionsitem.label == '溶栓束后即刻NIHSS评分' ||
                    optionsitem.label == '溶栓后24hNIHSS评分' ||
                    optionsitem.label == '溶栓后7±2天NIHSS评分' ||
                    optionsitem.label == '入院NIHSS评分' ||
                    optionsitem.label == '介入术后24hNIHSS评分' ||
                    optionsitem.label == '介入术前NIHSS评分'
                "
              />
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="意识水平 :" prop="resource">
          <el-radio-group v-model="ruleForm.resource">
            <el-radio
              v-for="(ConsciousnessItem, index) in levelOfConsciousness"
              :key="index"
              :label="ConsciousnessItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item
          label="意识水平提问（月份、年龄）："
          label-width="260px"
          prop="level"
        >
          <el-radio-group v-model="ruleForm.level">
            <el-radio
              v-for="(levelItem, index) in levelage"
              :key="index"
              :label="levelItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item
          label="意识水平提问（睁闭眼、捏拳松开）："
          label-width="265px"
          prop="eyesClosed"
        >
          <el-radio-group v-model="ruleForm.eyesClosed">
            <el-radio
              v-for="(EyesClosed, index) in levelEyesClosed"
              :key="index"
              :label="EyesClosed"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item label="眼睛—凝视 ：" prop="eyesGaze">
          <el-radio-group v-model="ruleForm.eyesGaze">
            <el-radio
              v-for="(GazeItem, index) in eyesGaze"
              :key="index"
              :label="GazeItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item label="眼睛—视野 ：" prop="eyesView">
          <el-radio-group v-model="ruleForm.eyesView">
            <el-radio
              v-for="(eyesViewItem, indFives) in eyesVision"
              :key="indFives"
              :label="eyesViewItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item label="面部—面瘫 ：" prop="facioplegia">
          <el-radio-group v-model="ruleForm.facioplegia">
            <el-radio
              v-for="(facioplegiaItem, index) in facialParalysis"
              :key="index"
              :label="facioplegiaItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item label="上肢运动（左上肢） ：" prop="upperMotion">
          <el-radio-group v-model="ruleForm.upperMotion">
            <el-radio
              v-for="(upperMotionItem, index) in upperMovement"
              :key="index"
              :label="upperMotionItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item label="上肢运动（右上肢） ：" prop="upperMotionb">
          <el-radio-group v-model="ruleForm.upperMotionb">
            <el-radio
              v-for="(upperMotionItem, index) in upperMovement"
              :key="index"
              :label="upperMotionItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item label="下肢运动（左下肢） ：" prop="lowerMotion">
          <el-radio-group v-model="ruleForm.lowerMotion">
            <el-radio
              v-for="(lowerMotionItem, index) in lowerMovement"
              :key="index"
              :label="lowerMotionItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item label="下肢运动（右下肢） ：" prop="lowerMotionb">
          <el-radio-group v-model="ruleForm.lowerMotionb">
            <el-radio
              v-for="(lowerMotionItem, index) in lowerMovement"
              :key="index"
              :label="lowerMotionItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item label="肢体共济失调 ：" prop="corpse">
          <el-radio-group v-model="ruleForm.corpse">
            <el-radio
              v-for="(corpseItem, index) in limbAtaxia"
              :key="index"
              :label="corpseItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item label="感觉 ：" prop="addfeel">
          <el-radio-group v-model="ruleForm.addfeel">
            <el-radio
              v-for="(addfeelItem, index) in feel"
              :key="index"
              :label="addfeelItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item
          label="语言（命名、阅读调试）："
          label-width="192px"
          prop="addlanguage"
        >
          <el-radio-group v-model="ruleForm.addlanguage">
            <el-radio
              v-for="(addlanguageItem, index) in language"
              :key="index"
              :label="addlanguageItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item label="构音障碍 ：" label-width="192px" prop="addDysarthria">
          <el-radio-group v-model="ruleForm.addDysarthria">
            <el-radio
              v-for="(addDysarthriaItem, index) in dysarthria"
              :key="index"
              :label="addDysarthriaItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item label="消退或不注意忽视 ：" label-width="192px" prop="fadeAway">
          <el-radio-group v-model="ruleForm.fadeAway">
            <el-radio
              v-for="(addAwayItem, index) in fadeAway"
              :key="index"
              :label="addAwayItem"
            />
          </el-radio-group>
        </el-form-item>
        <el-form-item label="备 注 :" prop="desc">
          <el-input v-model="ruleForm.desc" type="textarea" style="width: 80%" />
        </el-form-item>
        <!-- <el-form-item style="float: right; margin-right: 40px">
          
        </el-form-item> -->
      </el-form>
      <span slot="footer">
        <el-button @click="resetForm('ruleForm')">重 置</el-button>
        <el-button
          type="primary"
          @click="submitForm('ruleForm')"
        >保 存</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import echarts from 'echarts'
import { queryNIHSSData, saveStrokeNIHSS } from '@/api/green-channel/nihssScore'
export default {
  // 由主页面(父组件) 接收来的, 选择项的数据
  props: ['checkrowdata'], // 由主页面(父组件) 接收来的, 选择项的数据
  data() {
    return {
      /* 新增 */
      newincalogase: false,
      newRuleForm: '',
      ruleForm: {
        ratingType: '入院NIHSS评分',
        resource: '0 清醒，反应灵敏',
        level: '0 两项均正确',
        eyesClosed: '0 两项均正确',
        eyesGaze: '0 正常',
        eyesView: '0 无视野缺损',
        facioplegia: '0 正常',
        upperMotion: '0 无下落，置肢体于90度（或45度）坚持10秒',
        upperMotionb: '0 无下落，置肢体于90度（或45度）坚持10秒',
        lowerMotion: '0 无下落，于要求位置坚持5秒',
        lowerMotionb: '0 无下落，于要求位置坚持5秒',
        corpse: '0 无共济失调',
        addfeel: '0 正常',
        addlanguage: '0 正常',
        addDysarthria: '0 正常',
        fadeAway: '0 正常',
        desc: ''
      },
      rules: {
        ratingType: [{ required: true, message: '请选择评分类型', trigger: 'change' }],
        resource: [{ required: true, message: '请选择意识水平', trigger: 'change' }],
        level: [
          {
            required: true,
            message: '请选择意识水平提问（月份、年龄）',
            trigger: 'change'
          }
        ],
        eyesClosed: [
          {
            required: true,
            message: '请选择意识水平提问（睁闭眼、捏拳松开）',
            trigger: 'change'
          }
        ],
        eyesGaze: [{ required: true, message: '请选择眼睛—凝视', trigger: 'change' }],
        eyesView: [{ required: true, message: '请选择眼睛—视野 ', trigger: 'change' }],
        facioplegia: [{ required: true, message: '请选择面部—面瘫', trigger: 'change' }],
        upperMotion: [
          {
            required: true,
            message: '请选择上肢运动（左上肢）',
            trigger: 'change'
          }
        ],
        upperMotionb: [
          {
            required: true,
            message: '请选择上肢运动（右上肢）',
            trigger: 'change'
          }
        ],
        lowerMotion: [
          {
            required: true,
            message: '请选择下肢运动（左下肢）',
            trigger: 'change'
          }
        ],
        lowerMotionb: [
          {
            required: true,
            message: '请选择下肢运动（右下肢）',
            trigger: 'change'
          }
        ],
        corpse: [{ required: true, message: '请选择肢体共济失调', trigger: 'change' }],
        addfeel: [{ required: true, message: '请选择感觉', trigger: 'change' }],
        addlanguage: [
          {
            required: true,
            message: '请选择语言（命名、阅读调试）',
            trigger: 'change'
          }
        ],
        addDysarthria: [{ required: true, message: '请选择构音障碍', trigger: 'change' }],
        fadeAway: [
          {
            required: true,
            message: '请选择消退或不注意忽视',
            trigger: 'change'
          }
        ]
      },
      /* end------------ */

      options: [
        {
          value: '入院NIHSS评分',
          label: '入院NIHSS评分'
        },
        {
          value: '急诊NIHSS评分',
          label: '急诊NIHSS评分'
        },
        {
          value: '住院NIHSS评分',
          label: '住院NIHSS评分'
        },
        {
          value: '溶栓前NIHSS评分',
          label: '溶栓前NIHSS评分'
        },
        {
          value: '溶栓束后即刻NIHSS评分',
          label: '溶栓束后即刻NIHSS评分'
        },
        {
          value: '溶栓后24hNIHSS评分',
          label: '溶栓后24hNIHSS评分'
        },
        {
          value: '溶栓后7±2天NIHSS评分',
          label: '溶栓后7±2天NIHSS评分'
        },
        {
          value: '介入术前NIHSS评分',
          label: '介入术前NIHSS评分'
        },
        {
          value: '介入术后即刻NIHSS评分',
          label: '介入术后即刻NIHSS评分'
        },
        {
          value: '介入术后24hNIHSS评分',
          label: '介入术后24hNIHSS评分'
        },
        {
          value: '介入术后7±2天NIHSS评分',
          label: '介入术后7±2天NIHSS评分'
        },
        {
          value: '出院时NIHSS评分',
          label: '出院时NIHSS评分'
        }
      ],
      value: '',
      radio: '',
      levelOfConsciousness: [
        '0 清醒，反应灵敏',
        '1 嗜睡，轻微刺激能唤醒，可回答问题，执行指令',
        '2 昏睡或反应迟钝，需反复刺激、强烈或疼痛刺激才有非刻板的反应',
        '3 昏迷，仅有反射性活动或自发性反应或完全无反应、软瘫、无反射'
      ],
      levelage: ['0 两项均正确', '1 一项正确', '2 两项均不正确'],
      levelEyesClosed: ['0 两项均正确', '1 一项正确', '2 两项均不正确'],
      eyesGaze: [
        '0 正常',
        '1 部分凝视麻痹（单眼或双眼凝视异常，但无强迫凝视或完全凝视麻痹）',
        '2 强迫凝视或完全凝视麻痹（不能被头眼反射克服）'
      ],
      eyesVision: [
        '0 无视野缺损',
        '1 部分偏盲',
        '2 完全偏盲',
        '3 双侧偏盲（包括皮质盲）'
      ],
      facialParalysis: [
        '0 正常',
        '1 轻微（微笑时鼻唇沟变平、不对称）',
        '2 部分（下面部完全或几乎完全瘫痪）',
        '3 完全（单或双侧瘫痪，上下面部缺乏运动）'
      ],
      upperMovement: [
        '0 无下落，置肢体于90度（或45度）坚持10秒',
        '1 能抬起但不能坚持10秒，下落时不撞击床或其他支持物',
        '2 试图抵抗重力，但不能维持坐位90度或仰位45度',
        '3 不能抵抗重力，肢体快速下落',
        '4 无运动',
        '9 截肢或关节融合（解释：5a左上肢；5b右上肢）'
      ],
      lowerMovement: [
        '0 无下落，于要求位置坚持5秒',
        '1 5秒末下落，不撞击床',
        '2 5秒内下落到床上，可部分抵抗重力',
        '3 立即下落到床上，不能抵抗重力',
        '4 无运动',
        '9 截肢或关节融合（解释：6a 左下肢； 6b右下肢）'
      ],
      limbAtaxia: [
        '0 无共济失调',
        '1 一个肢体有',
        '2 两个肢体有，共济失调在：右上肢1=有，2=无',
        '9 截肢或关节融合，解释：右上肢1=有，2=无'
      ],
      feel: [
        '0 正常',
        '1 轻-中度感觉障碍（患者感觉针刺不尖锐或迟钝，或针刺感缺失但有触觉）',
        '2 重度-完全感觉缺失（面、上肢、下肢无触觉）'
      ],
      language: [
        '0 正常',
        '1 轻-中度失语：流利程度和理解能力部分下降，但表达无明显受限',
        '2 严重失语，交流是通过患者破碎的语言表达，听者须推理、询问、猜测，交流困难',
        '3 不能说话或者完全失语，无言语或听力理解能力'
      ],
      dysarthria: [
        '0 正常',
        '1 轻-中度，至少有些发音不清，虽有困难但能被理解',
        '2 言语不清，不能被理解，但无失语或与失语不成比例，或失音',
        '9 气管插管或其他物理障碍'
      ],
      fadeAway: [
        '0 正常',
        '1 视、触、听、空间觉或个人的忽视；或对一种感觉的双侧同时刺激忽视',
        '2 严重的偏侧忽视或一种以上的偏侧忽视；不认识自己的手；只能对一侧空间定位'
      ],
      input: '',
      dialogVisible: false,
      option: {
        tooltip: {
          trigger: 'axis',
          formatter: '结论分级: {b} <br/> 评分 : {c}  (分)'
        },
        xAxis: {
          type: 'category',
          data: []
        },
        yAxis: {
          type: 'value'
        },
        dataZoom: [
          {
            type: 'inside'
          }
        ],
        series: [
          {
            data: [],
            type: 'line',
            itemStyle: { normal: { label: { show: true }}}
          }
        ]
      },
      optionSeriesData: [],
      optionXAxisData: [],
      NIHSSDataList: [],
      NIHSSDataListValue: [
        'action',
        'birth',
        'consciousness',
        'dysarthria',
        'facialParalysis',
        'feel',
        'gaze',
        'language',
        'limbAtaxia',
        'lowerLimbMovement',
        'lowerLimbMovementb',
        'subside',
        'upperLimbMovement',
        'upperLimbMovementb',
        'view'
      ]
    }
  },
  computed: {},
  updated() {},
  created() {
    this.getNIHSSData()
  },
  mounted() {},
  methods: {
    /* 新增--------------------- */
    popup() {
      this.newincalogase = true
    },
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then((_) => {
          done()
        })
        .catch((_) => {})
    },
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log(this.ruleForm, 'ruleForm')
          console.log(this.checkrowdata, 'checkrowdata')
          const arr = []
          for (const i in this.ruleForm) {
            console.log(i, 'i1')
            if (i !== 'ratingType' && i !== 'desc') {
              arr.push(this.ruleForm[i] ? this.ruleForm[i].split(' ')[0] : '')
            }
          }
          const score =
            (Number(arr[0]) === 9 ? 0 : Number(arr[0])) +
            (Number(arr[1]) === 9 ? 0 : Number(arr[1])) +
            (Number(arr[2]) === 9 ? 0 : Number(arr[2])) +
            (Number(arr[3]) === 9 ? 0 : Number(arr[3])) +
            (Number(arr[4]) === 9 ? 0 : Number(arr[4])) +
            (Number(arr[5]) === 9 ? 0 : Number(arr[5])) +
            (Number(arr[6]) === 9 ? 0 : Number(arr[6])) +
            (Number(arr[7]) === 9 ? 0 : Number(arr[7])) +
            (Number(arr[8]) === 9 ? 0 : Number(arr[8])) +
            (Number(arr[9]) === 9 ? 0 : Number(arr[9])) +
            (Number(arr[10]) === 9 ? 0 : Number(arr[10])) +
            (Number(arr[11]) === 9 ? 0 : Number(arr[11])) +
            (Number(arr[12]) === 9 ? 0 : Number(arr[12])) +
            (Number(arr[13]) === 9 ? 0 : Number(arr[13])) +
            (Number(arr[14]) === 9 ? 0 : Number(arr[14]))
          let result = ''
          if (score <= 0) {
            result = '正常或近乎正常'
          } else if (score <= 1) {
            result = '正常或近乎正常'
          } else if (score <= 4) {
            result = '轻度卒中/小卒中'
          } else if (score <= 15) {
            result = '中度卒中'
          } else if (score <= 20) {
            result = '中-重度卒中'
          } else if (score <= 42) {
            result = '中度卒中'
          } else if (score <= 58) {
            result = ''
          } else {
            result = ''
          }
          const data = {
            action: this.ruleForm.level,
            birth: this.ruleForm.eyesClosed,
            consciousness: this.ruleForm.resource,
            departmentName: this.checkrowdata.departmentName,
            dispatchId: this.checkrowdata.dispatchId,
            dysarthria: this.ruleForm.addDysarthria,
            facialParalysis: this.ruleForm.facioplegia,
            feel: this.ruleForm.addfeel,
            gaze: this.ruleForm.eyesGaze,
            id: null,
            language: this.ruleForm.addlanguage,
            limbAtaxia: this.ruleForm.corpse,
            lowerLimbMovement: this.ruleForm.lowerMotion,
            lowerLimbMovementb: this.ruleForm.lowerMotionb,
            medicalId: this.checkrowdata.medicalId,
            pageNum: null,
            pageSize: null,
            remark: this.ruleForm.desc,
            result: result,
            score: score,
            subside: this.ruleForm.fadeAway,
            type: this.ruleForm.ratingType,
            upperLimbMovement: this.ruleForm.upperMotion,
            upperLimbMovementb: this.ruleForm.upperMotionb,
            userId: this.$store.getters.userId,
            userName: this.checkrowdata.doctorName,
            view: this.ruleForm.eyesView
          }
          saveStrokeNIHSS(data)
            .then((res) => {
              this.$message({
                type: 'success',
                message: '保存成功'
              })
              this.newincalogase = false
              this.$refs[formName].resetFields()
              this.getNIHSSData()
            })
            .catch(() => {
              this.$message({
                type: 'error',
                message: '保存失败'
              })
            })
        } else {
          console.log('error submit!!')
          return false
        }
      })
    },
    saveStrokeNIHSSData(data_value) {
      saveStrokeNIHSS(data_value)
        .then((res) => {
          this.$message({
            type: 'success',
            message: '保存成功'
          })
        })
        .catch(() => {
          this.$message({
            type: 'error',
            message: '保存失败'
          })
        })
    },
    changeValue(data_value) {
      const arr = []
      for (const i in data_value) {
        console.log(i, 'i1')
        if (this.NIHSSDataListValue.indexOf(i) !== -1) {
          arr.push(data_value[i] ? data_value[i].split(' ')[0] : '')
        }
      }
      console.log('data_value', data_value)
      console.log('arr', arr)
      const score =
        (Number(arr[0]) === 9 ? 0 : Number(arr[0])) +
        (Number(arr[1]) === 9 ? 0 : Number(arr[1])) +
        (Number(arr[2]) === 9 ? 0 : Number(arr[2])) +
        (Number(arr[3]) === 9 ? 0 : Number(arr[3])) +
        (Number(arr[4]) === 9 ? 0 : Number(arr[4])) +
        (Number(arr[5]) === 9 ? 0 : Number(arr[5])) +
        (Number(arr[6]) === 9 ? 0 : Number(arr[6])) +
        (Number(arr[7]) === 9 ? 0 : Number(arr[7])) +
        (Number(arr[8]) === 9 ? 0 : Number(arr[8])) +
        (Number(arr[9]) === 9 ? 0 : Number(arr[9])) +
        (Number(arr[10]) === 9 ? 0 : Number(arr[10])) +
        (Number(arr[11]) === 9 ? 0 : Number(arr[11])) +
        (Number(arr[12]) === 9 ? 0 : Number(arr[12])) +
        (Number(arr[13]) === 9 ? 0 : Number(arr[13])) +
        (Number(arr[14]) === 9 ? 0 : Number(arr[14]))
      let result = ''
      if (score <= 0) {
        result = '正常或近乎正常'
      } else if (score <= 1) {
        result = '正常或近乎正常'
      } else if (score <= 4) {
        result = '轻度卒中/小卒中'
      } else if (score <= 15) {
        result = '中度卒中'
      } else if (score <= 20) {
        result = '中-重度卒中'
      } else if (score <= 42) {
        result = '中度卒中'
      } else if (score <= 58) {
        result = ''
      } else {
        result = ''
      }
      data_value.score = score
      data_value.result = result
      return data_value
    },
    resetForm(formName) {
      this.$refs[formName].resetFields()
    },

    /* end---------------------- */

    goViewNIHSS() {
      this.dialogVisible = true
      this.$nextTick(function() {
        this.drawLine()
      })
    },
    drawLine() {
      const chart = this.$refs.chart
      if (chart) {
        const myChart = echarts.init(chart)
        this.option.xAxis.data = this.optionXAxisData
        this.option.series[0].data = this.optionSeriesData
        myChart.setOption(this.option)
      }
    },
    getNIHSSData() {
      this.optionSeriesData = []
      this.optionXAxisData = []
      var data = { dispatchId: this.checkrowdata.dispatchId }
      queryNIHSSData(data).then((res) => {
        var DataList = res.data.list
        this.NIHSSDataList = DataList
        // console.log('NIHSSDataList', this.NIHSSDataList)
        for (var index in this.NIHSSDataList) {
          if (this.NIHSSDataList[index].limbAtaxia == '9 截肢或关节融合') {
            this.NIHSSDataList[index].limbAtaxia =
              '9 截肢或关节融合，解释：右上肢1=有，2=无'
          }

          if (this.NIHSSDataList[index].lowerLimbMovement == '9 截肢或关节融合') {
            this.NIHSSDataList[index].lowerLimbMovement =
              '9 截肢或关节融合（解释：6a 左下肢； 6b右下肢）'
          }

          if (this.NIHSSDataList[index].lowerLimbMovementb == '9 截肢或关节融合') {
            this.NIHSSDataList[index].lowerLimbMovementb =
              '9 截肢或关节融合（解释：6a 左下肢； 6b右下肢）'
          }
          if (this.NIHSSDataList[index].upperLimbMovement == '9 截肢或关节融合') {
            this.NIHSSDataList[index].upperLimbMovement =
              '9 截肢或关节融合（解释：5a左上肢；5b右上肢）'
          }
          if (this.NIHSSDataList[index].upperLimbMovementb == '9 截肢或关节融合') {
            this.NIHSSDataList[index].upperLimbMovementb =
              '9 截肢或关节融合（解释：5a左上肢；5b右上肢）'
          }
          var score = Number(this.NIHSSDataList[index].score)
          const result = this.NIHSSDataList[index].result
          // console.log(this.NIHSSDataList[index].score,result);
          // this.optionSeriesData.push(score)
          this.optionSeriesData.push({ value: score, name: result || '未知' })
          this.optionXAxisData.push(this.NIHSSDataList[index].type)
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>
#box {
  width: 100%;
  height: 100%;
}

.tab-pane {
  overflow: hidden;
  width: 100%;
  background-color: white;
  margin: 0px 0px 20px 0px;
  padding: 10px 20px;
  position: relative;
}

.addContent {
  width: 100%;
  height: 50px;
  border-bottom: 1px solid #dfdee3;
}

.content {
  margin-top: 20px;
  background-color: whitesmoke;
}

.inside {
  padding: 10px;
}

.footerContent {
  background-color: white;
  border-top: 1px solid #dfdee3;
}

.each {
  padding-left: 10px;
  margin: 10px 0;
}

.eachItem {
  padding: 5px 0 5px 0px;
}

.text {
  float: left;
  font-size: 14px;
}

.single {
  margin: 0px 0 5px 10px;
}

/deep/.el-dialog__body{
  padding: 10px 20px;
}
/* 新增弹窗 */
.demo-ruleForm {
  // height: 500px;
  // overflow: auto;
  .el-form-item {
    margin-bottom: 0
  }
}
</style>
